package com.spa.interfaces;

import cn.dev33.satoken.exception.NotLoginException;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import javax.servlet.http.HttpServletRequest;

/**
 * 用于处理Filter 异常转发处理
 *
 * @author: lig
 * @date: 2024/1/11
 */
@RestController
public class ExceptionController {

    /**
     * 异常处理 controller request url
     */
    public static final String ERROR_CONTROLLER_PATH = "/filter/error/throw";

    @RequestMapping(ERROR_CONTROLLER_PATH)
    public void handleException(HttpServletRequest request){
        throw (NotLoginException) request.getAttribute("filterNotLoginError");
    }

}
